<template>
  <div v-show="show" class="loading">
    <div class="loading-icon">
      <span></span>
      <span></span>
      <span></span>
      <span></span>
      <span></span>
    </div>
  </div>
</template>

<script>
export default {
  name: 'Loading',
  data() {
    return {
      show: false
    }
  }
}
</script>

<style scoped>
@keyframes load {
  0%,
  100% {
    height: 40px;
    background-color: lightgreen;
  }
  50% {
    height: 70px;
    background-color: lightblue;
  }
}

.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 99;
  background-color: rgba(0, 0, 0, 0.4);
}
.loading-icon {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 40px;
}
.loading-icon span {
  display: inline-block;
  width: 8px;
  height: 100%;
  margin: 0 5px;
  border-radius: 4px;
  background-color: lightgreen;
  animation: load 1s ease infinite;
}
.loading-icon span:nth-child(2) {
  animation-delay: 0.2s;
}
.loading-icon span:nth-child(3) {
  animation-delay: 0.4s;
}
.loading-icon span:nth-child(4) {
  animation-delay: 0.6s;
}
.loading-icon span:nth-child(6) {
  animation-delay: 0.8s;
}
</style>
